package com.mayuanfei.service;

import com.aizuda.snailjob.client.core.retryer.RetryTaskTemplateBuilder;
import com.aizuda.snailjob.client.core.retryer.SnailJobTemplate;
import com.mayuanfei.service.impl.MyHandRetryMethod;
import org.springframework.stereotype.Component;

/**
 * TODO 类描述
 *
 * @author 老马
 * @date 2025-04-23 14:40
 */
@Component
public class HandRetryMethodService {

    public void handRetryMethod(String params) {
        System.out.println("handRetryMethod");
        SnailJobTemplate snailJobTemplate = RetryTaskTemplateBuilder.newBuilder()
                // 手动指定场景名称
                .withScene(MyHandRetryMethod.SCENE)
                // 指定要执行的任务
                .withExecutorMethod(MyHandRetryMethod.class)
                // 指定参数
                .withParam("handRetryMethod")
                .build();
        // 执行模板
        snailJobTemplate.executeRetry();
    }
}